<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="程月">
    <title>select</title>
     <style>
    *{
        box-sizing: border-box;
    }
    body{
        width: 100%;
        height: 10000px;
        margin: 0;
    }
    ul{
        margin: 0;
        padding: 0;
        list-style: none;
    }
    a{
         text-decoration:none;
         font-size:inherit;
         color:inherit;
    }
        main{
            width: 200px;
            height: 30px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
        }
        div{
            width: 49.9%;
            line-height: 30px;
            text-align: center;
        }
        .left{
            background-color: lightskyblue;
        }
        .right{
            border: 1px  solid #ccc;
            background-color: #aaa;
        }
        ul{
            position: relative;
            top: -2px;
            display: none;
        }
        li{
            border: 1px  solid #ccc;
        }
    </style>
</head>
<body>
    <main>
        <div class="left">选择项目:</div>
        <div class="right">
            <section>未选择</section>
            <ul>
                <li><a href="#">html5</a></li>
                <li><a href="#">css3</a></li>
                <li><a href="#">js</a></li>
                <li><a href="#">jquery</a></li>
            </ul>
        </div>
    </main>
    <script src="./jquery.js"></script>
</body>
</html>
<script>
    $('section').click(function(ev){
        ev.stopPropagation();
        $('ul').css('display','block');
    });

    $('li').mouseover(function(){
        $(this).css('background-color','#aaa').siblings().css('background-color','#fff');
    });

    $('li').click(function(ev){
        ev.stopPropagation();
        $('ul').css('display','none');
        $('section').text($(this).text());
    });

    $('body').click(function(){
        $('ul').css('display','none');
    });
</script>